package com.bvgol.examples.nio.zerocp.old;/**
 * @Classname OldIOServer
 * @Description TODO
 * @Date 2021/7/5 17:50
 * @Created by GUOCHEN
 */

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @program: my-spring-completely
 * @description:
 * @author: GUOCHEN
 * @create: 2021/07/05 17:50
 */
public class OldIOServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(7001);

//        DataInputStream dataInputStream = new DataInputStream(serverSocket);
        while (true){
            Socket accept = serverSocket.accept();
            DataInputStream dataInputStream = new DataInputStream(accept.getInputStream());
            byte[] bytes = new byte[4096];
            while (true){
                int read = dataInputStream.read(bytes, 0, bytes.length);
                if (-1==read){
                    break;
                }
            }
        }
    }
}
